import os
import pandas as pd
import glob
from tqdm import tqdm

img_path = '../../Dataset-fu/test/*'
# img_path = '../../Dataset/trainval/*/*'
train = False
img_all = glob.glob(img_path)
image_list = []
label_list = []
for img in tqdm(img_all):
    if train:
        label = img.split('\\')[-2]
        image = label + '/' + img.split('\\')[-1]
        image_list.append(image)
        label_list.append(label)
    else:
        image = img.split('/')[-1]
        image_list.append(image)

df_img = pd.Series(image_list)
df_lab = pd.Series(label_list, index=None)
train_csv = pd.concat([df_img, df_lab], axis=1)
df_img.to_csv('../../Dataset-fu/test.csv', index=False, header=['image'])
# train_csv.to_csv('../../Dataset/trainval.csv', index=False, header=['image', 'label'])

print('done!')
